//
//  LoadingView.m
//  KoreaFlower
//
//  Created by Nicejinux on 12. 12. 23..
//  Copyright (c) 2012년 Nicejinux. All rights reserved.
//

#import "LoadingView.h"

#define IMAGE_COUNT                             8
#define IMAGE_WIDTH                             44
#define IMAGE_HEIGHT                            44

@implementation LoadingView

- (id)initWithFrame:(CGRect)frame
{
    frame.size = CGSizeMake(IMAGE_WIDTH, IMAGE_HEIGHT);
    
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        
        // Animation 갯수 만큼 이미지를 담을 array
        NSMutableArray *imageList = [NSMutableArray arrayWithCapacity:IMAGE_COUNT];
        
        // Build array of images, cycling through image names
        for (int i = 0; i < IMAGE_COUNT; i++)
        {
            [imageList addObject:[UIImage imageNamed:[NSString stringWithFormat:@"loading_%02d", i+1]]];
        }
        
        self.animationImages = imageList;
        
        // One cycle 완료할때까지의 걸린 시간
        self.animationDuration = 0.7;
    }
    return self;
}

- (id)init
{
    self = [self initWithFrame:CGRectMake(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT)];
    
    return self;
}

@end
